import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast';

Page({

  data: {
    top: 0,
    show: false,
    width: 295,
    height: 413
  },

  onLoad(options) {
    const info = wx.getSystemInfoSync();
    this.setData({
      top: 434 * info.windowHeight / 603 + 10 * info.pixelRatio / 2
    })
  },

  goOrder() {
    wx.switchTab({
      url: '/pages/order/order',
    });
  },

  goHome() {
    wx.switchTab({
      url: '/pages/index/index',
    })
  },

  showDialog() {
    this.setData({
      show: true,
    })
  },

  goDetail() {
    if (this.data.width.length < 1 || this.data.height.length < 1) {
      Toast('请输入正确的宽高')
    } else {
      wx.navigateTo({
        url: `/pages/productDetail/productDetail?productId=6286308d68435e0230120492&width=${this.data.width}&height=${this.data.height}&free=1`,
      })
    }
  }

})